<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title></title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <script th:inline="javascript" type="text/javascript">
        /*<![CDATA[*/
        /**
         * 应用程序URL根路径
         * @type {string}
         * @const
         */
        var BASE_URL = /*[[@{/}]]*/ '/';
        alert(BASE_URL);
        /*]]>*/

    </script>
</head>
<body>
你好
<video id="video" autoplay=""></video>
<script type="text/javascript">
    var video_element=document.getElementById('video');
    if(navigator.getUserMedia){ // opera应使用opera.getUserMedianow
        navigator.getUserMedia('video',success,error);  //success是回调函数,当然你也可以直接在此写一个匿名函数
    }
    function success(stream){
        video_element.src=stream;
    }
    function error() {
        alert('error');
    }
</script>
</body>
</html>